package com.cupk.carManageMaster.api.controller;

import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@CrossOrigin
public class RouterController {

    @Autowired
    Gson gson;


    @GetMapping("/index")
    @ResponseBody
    @CrossOrigin
    public String index() {
        String result = "这是首页";
        return result;
    }

    @GetMapping("/vip1")
    @ResponseBody
    @CrossOrigin
    public String vip1() {
        String result = "这是vip1";
        return result;
    }

    @GetMapping("/vip2")
    @ResponseBody
    @CrossOrigin
    public String vip2() {
        List<String> ss = new ArrayList<>();
        ss.add("sb");
        ss.add("sb1");
        ss.add("sb2");
        ss.add("sb3");
        return gson.toJson(ss);
    }
}
